﻿######################################################/
## Anticipated Election Result and Protest Voting    ##
## DOI: 10.1017/S0008423919000325                    ##
## -- Replication Material (Master File)             ##
## by: Christian Schimpf                             ##
## Version: July 01, 2019                            ##
######################################################/

# This READ ME.txt file provides the necessary information to replicate the
# analyses for the paper "Anticipated election result and protest voting: 
# why and when Canadian voters signal discontent" which was published in
# the Canadian Journal of Political Science (doi:)

# The replication materials include a dataset ("dfCan2015.RData"), four
# R-Scripts and this txt file. The analysis requires R (the original 
# analysis was carried out in R-Studio).

# All recodes, analyses, etc. can be run from the Master R-Script
# (provided all paths specified in the files are adjusted accordingly). The
# following provides an overview of the R-Scripts and their role in the 
# replication process:

# 1. CJPS_Schimpf_Replication_MasterFile (Can be used to call and run the 
#    the other three R-Scripts.)

# 2. CJPS_Schimpf_Replication_DataPrep1_20190107.R (Is used to generate a 
#    dataset based on the original Making Electoral Democracy Work datasets)

# 3. CJPS_Schimpf_Replication_DataPrep2_20190107.R (Used to derive all 
#    variables used in the main analyses and the robustness checks in the 
#    Online Supplementary Files)

# 4. CJPS_Schimpf_Replication_Analyses_20190107.R (Used to generate all 
#    descriptive statistics, Figures, main regression analyses, and
#    robustness checks reported in the online appendix).

# The first R-Script can only be run after downloading three separate 
# datasets from the Harvard Dataverse Making Electoral Democracy Work
#  website:
# Cross, William; Gélineau, François; Gidengil, Elisabeth; Pruysers, Scott; 
# Andrea, Lawlor; Blais, André; Stephenson, Laura, 2017, "MEDW 2015 
# Canadian Federal Election Study", https://doi.org/10.7910/DVN/ITIJT0 , 
# Harvard Dataverse, V1, UNF:6:JuosJ+68xEwFwPlp7EiMlw== [fileUNF] 
# https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN
# /ITIJT0
# (Last accessed: July 1, 2019)
#
# The files to be downloaded are:
# British_Columbia_federal_2015.dta
# Ontario_federal_2015.dta
# Quebec_federal_2015.dta
# (The site also includes the codebooks that may be helpful in understanding
# the original variables)

# After downloading the datasets, the should be saved in a folder along with
# the R-Scripts. Paths defined in the R-Scripts need to be adjusted before
# running the analyses. Further information about how to identify these paths
# is given in the R-Scripts.

# The analysis, however, can also be replicated without retrieving the 
# original files. The R-Script "DataPrep1" was used to derive a dataset
# containing all variables of interest which were saved as "dfCan2015.RData"
# and which is called directly in R-Script "DataPrep2."

# For this project, the original MEDW files were last downloaded on March 
# 3, 2018. Any changes being made to the original files may thus lead to 
# differences in the results. Further discrepancies may arise from using 
# different R-Versions or alternative versions of the R-packages used for
# the analyses. For the original analysis, I used R Version 3.4.0 and all
# packages, updated as of July 1, 2019.  
